package main

import "fmt"

func main() {
	fmt.Println(majorityElement([]int{2,2,1,1,1,2,2}))
}

func majorityElement(nums []int) int {
	var ret int
	freqMap := make(map[int]int)
	for _,value := range nums {
		freqMap[value] += 1
	}
	for k, v := range freqMap {
		if v > len(nums) / 2 {
			ret = k
			break
		}
	}
	return ret
}
